package org.sundatagroup.aurora.show.entity.status;

import com.google.gson.JsonObject;

/**
 * <p>状态产生工厂
 * </p>
 * 
 * @author Zdream
 * @date 2018-05-23
 * @since 0.2.0
 */
public class StatusFactory {

	public static IStatusEntity build(JsonObject jo) {
		switch (jo.get("status").getAsString()) {
		case "playing":
			return new PlayingStatus(jo);
		case "ready":
			return new ReadyStatus(jo);
		case "waiting":
			return new WaitingStatus(jo);

		default:
			throw new IllegalArgumentException("JSON: " + jo.toString() + "无法解析成状态");
		}
	}

}
